docBlockNameImporter = $docBlockNameImporter; $this->phpDocInfoFactory = $phpDocInfoFactory; $this->docBlockUpdater = $docBlockUpdater; $this->addUseStatementGuard = $addUseStatementGuard; } /** * @return \PhpParser\Node|int|null */ public function enterNode(Node $node) { if (!$node instanceof Stmt && !$node instanceof Param) { return null; } $phpDocInfo = $this->phpDocInfoFactory->createFromNode($node); if (!$phpDocInfo instanceof PhpDocInfo) { return null; } $hasDocChanged = $this->docBlockNameImporter->importNames($phpDocInfo->getPhpDocNode(), $node); if (!$hasDocChanged) { return null; } $this->docBlockUpdater->updateRefactoredNodeWithPhpDocInfo($node); return $node; } /** * @param Stmt[] $stmts */ public function shouldTraverse(array $stmts) : bool { return $this->addUseStatementGuard->shouldTraverse($stmts, $this->getFile()->getFilePath()); } }